<!DOCTYPE html
		PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport"
			content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="format-detection" content="telephone=no" />
		<meta name="wap-font-scale" content="no" />
		<title>注冊</title>
		<link rel="stylesheet" type="text/css" href="/css/public.css" />
		<link rel="stylesheet" type="text/css" href="/css/enterFm.css" />
		<script type="text/javascript" src="/js/jquery-1.11.1.min.js"></script>
		<script type="text/javascript" src="/js/iscroll.js"></script>
		<script type="text/javascript" src="/js/common.js"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				$(".mobile_menu_title").text("注册");
				$("select").change(function() {
					$(this).prev("em").text($(this).val());
				});
			});
		</script>
		<script language="javascript">
			function checkform() {
				if (form.un.value == "") {
					alert("请填写用户名。");
					return false;
				}
				if (form.email.value == "") {
					alert("请填写你的个人E-mail。");
					return false;
				}
				if (form.tel.value == "") {
					alert("请填写你的联系方式。");
					return false;
				}
				if (form.place.value == "" || form.city.value == "") {
					alert("请选择所在地区和城市。");
					return false;
				}
				if (form.psw.value == "" || form.psw.value == "") {
					alert("密码不得为空。");
					return false;
				}

			}
		</script>

	</head>

	<style>
		.error{
			color: red;
		}
	</style>
	<body>

		<div class="outBox">

			<!--页头 开始-->
			<div th:include="common/head :: top" class="head"></div>
			<!--页头 结束-->


			<div class="content">
				<div class="title">注册账户</div>

				<div class="fm_box">
<!--					<form method="post" action="/register" onsubmit="return checkform()" name="form">-->
						<ul class="fm_list">
							<li>
								<span>用户名</span>
								<div class="inp_box">
									<input type="text" name="username" id="username"/>

								</div>
							</li>
							<li>
								<span>密码</span>
								<div class="inp_box">
									<input type="password" name="password" id="password"/>
								</div>
							</li>
							<li>
								<span>确认密码</span>
								<div class="inp_box">
									<input type="password" name="psw" />
								</div>
							</li>

							<li>
								<span>性别</span>
								<div class="area_sel">
									<em class="sel_box">男</em>
									<select name="gender">
										<option value="男" selected>男
										<option value="女">女
									</select>
								</div>
							</li>

							<li>
								<span>MSN / QQ</span>
								<div class="inp_box">
									<input type="text" name="qqmsn" />
								</div>
							</li>
							<li>
								<span>E-mail</span>
								<div class="inp_box">
									<input type="text" name="email" id="email"/>
								</div>
							</li>
							<li>
								<span>所在地区</span>
								<div class="area_sel">
									<em class="sel_box">中国大陆</em>
									<select name="place">
										<option value="中國大陸" selected>中国大陆
										<option value="台灣">台湾
										<option value="香港">香港
										<option value="澳門">澳门
										<option value="東南亞諸囯">东南亚诸囯
										<option value="亞洲其他地區">非洲其他地区
										<option value="歐洲">欧洲
										<option value="美洲">美洲
										<option value="大洋洲">大洋洲
										<option value="非洲">非洲
										<option value="其他星球">其他星球
									</select>
								</div>
							</li>
							<li>
								<span>城市</span>
								<div class="inp_box">
									<input type="text" name="city" />
								</div>
							</li>
<!--							验证码-->
<!--							<li>-->
<!--								<span>验证码</span>-->
<!--								<div class="inp_box yz_box">-->
<!--									<input type="text" name="checkcode" class="yz_wd" />-->
<!--								</div>-->
<!--								<div class="form-group">-->
<!--									<input type="text" class="form-control" name="code" placeholder="验证码" required="">-->
<!--									<span class="p-new-code l-mar-r15"> <img src="http://127.0.0.1:5678/kaptcha/getKaptchaImage" class="reloadImage" id="reloadImage"-->
<!--																			 width="121" height="40"/> </span>-->
<!--									<a href="javaScript:;" class="l-color9 reloadImage">看不清楚，换一张</a>-->
<!--								</div>-->
<!--							</li>-->
						</ul>
<!--						<span class="error" th:text="${session.msg}" style="text-align: center"></span>-->
						<div class="sub_btn">
							<button onclick="register()">立即注册</button>
						</div>

						<div class="link_box">已有账户，<a href="login.html">立即登录</a></div>

<!--					</form>-->
				</div>

			</div>

		</div>
		<script>
			/**************************验证码****************************/
			$(".reloadImage").click(function () {
				//获取当前的时间作为参数，无具体意义
				var timenow = new Date().getTime();
				$('#reloadImage').attr("src", "http://127.0.0.1:5678/kaptcha/getKaptchaImage?date=" + timenow);
			});
		</script>
	<script type="text/javascript">

		function register() {
			var username=$("#username").val()
			var password=$("#password").val()
			var email=$("#email").val()
			$.ajax({
				type:"POST",
				url: "/register",
				data: {
					"username": username,
					"password": password,
					"email": email
				},
				success:function (result) {
					alert(result.code+" "+result.msg);
					if (result.code==20000){
						location.href="/tologin";
					}
				}
			});
		}
	</script>
	</body>
</html>
